//
//  GLEnterView.m
//  QAQ打飞机
//
//  Created by admin on 15/9/7.
//  Copyright (c) 2015年 gl. All rights reserved.
//

#import "GLEnterView.h"
#import "GLMainViewController.h"
#import "GLImageResource.h"
#import "GLSoundToo.h"
#import "GLGameViewController.h"
@interface GLEnterView ()
{
    //开始游戏
    UIButton *_game;
    //排行榜
    UIButton *_score;
    //图像数据
    GLImageResource *_imageresource;
    //声音
    GLSoundToo*_soundtoo;
    UIAlertView *_sheet;
    NSString *_name;
}
@end

@implementation GLEnterView
- (void)viewDidLoad {
    [super viewDidLoad];
        
    
    
    [self.view setBackgroundColor:[UIColor blackColor]];
    UIImage *backImage =[UIImage imageNamed:@"imageView.bundle/messageGirl.png"];
    UIImageView *backImageView =[[UIImageView alloc]initWithImage:backImage];
    [backImageView setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self.view addSubview:backImageView];
    //加载图像数据
    _imageresource=[[GLImageResource alloc]init];
//    //开始按钮
    [self loadBeginGameButton];
    //排行榜
    //[self loadBeginScoreButton];
    _soundtoo=[[GLSoundToo alloc]init];
    //
    
}

#pragma mark -私有方法
#pragma mark -加载开始游戏按钮
-(void)loadBeginGameButton
{
    _game =[UIButton buttonWithType:UIButtonTypeCustom];
    [_game setImage:_imageresource.BeginGameImage forState:UIControlStateNormal];
    CGSize size =_imageresource.BeginGameImage.size;
    [_game setFrame:CGRectMake(self.view.frame.size.width/2.0-size.width/2.0, self.view.frame.size.height/1.3, size.width, size.height)];
    [_game addTarget:self action:@selector(go) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_game];

}
-(void)go
{
    [_soundtoo playAudioWithName:arc4random_uniform(1)? kVoice1:kVoice2];
    GLMainViewController*p=[[GLMainViewController alloc]init];
    [self presentViewController:p animated:YES completion:nil];
}
//- (void)Begingame
//{
//    
//    
//        _sheet =[[UIAlertView alloc]init];
//        [_sheet setAlertViewStyle:UIAlertViewStylePlainTextInput];
//        [_sheet setTitle:@"请输入您的游戏昵称"];
//        [_sheet addButtonWithTitle:@"确定"];
//        [_sheet setDelegate:self];
//        [_sheet show];
//    
//  
//    
//    [_soundtoo playAudioWithName:arc4random_uniform(1)? kVoice1:kVoice2];
//   
//}
//-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
//{
//    
//    GLMainViewController*p=[[GLMainViewController alloc]init];
//    [self presentViewController:p animated:YES completion:nil];
//    
//    
//}


@end
